package com.ichina.chat.dao;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.ichina.chat.vo.Traffic;
import com.ichina.chat.vo.UserInfo;

public interface TrafficDao 
{
	/**
	 * 增加一行信息
	 * @param u
	 * @throws Exception
	 */
	public void addTraffic(Traffic u) throws Exception;
	
	/**
	 * 根据IP删除
	 * @param ip
	 * @return
	 * @throws Exception
	 */
	public boolean deleteTraffic(String ip) throws Exception;
	
	/**
	 * 根据ID更新
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public boolean updateUer(int id) throws  Exception;
	
	/**
	 * 根据IP更新
	 * @param u
	 * @return
	 * @throws Exception
	 */
	public boolean updateTraffic(Traffic u) throws Exception;
	
	/**
	 * 根据某IP查询是否来过
	 * @param ip
	 * @return
	 * @throws Exception
	 */
	public int queryUserByIp(String ip) throws Exception;
	
	/**
	 * 根据今天时间查询,IP以日(00:00-24:00,为一个IP)划分
	 * @param time
	 * @return
	 * @throws Exception
	 */
	public int queryUserByToday(Date time) throws Exception;
	
	/**
	 * 根据今天日期查询昨天访问数,IP以日(00:00-24:00,为一个IP)划分
	 * @param time
	 * @return
	 * @throws Exception
	 */
	public int queryUserByYesterday(Date time) throws Exception;
	
	/**
	 * 根据今天日期查询上星期访问数,IP以日(00:00-24:00,为一个IP)划分
	 * @param time
	 * @return
	 * @throws Exception
	 */
	public int queryUserByLastWeek(Date time) throws Exception;
	
	/**
	 * 根据今天日期查询上个月访问数,IP以日(00:00-24:00,为一个IP)划分
	 * @param time
	 * @return
	 * @throws Exception
	 */
	public int queryUsrByLastMonth(Date time) throws Exception;
	
	/**
	 * 根据今天日期查询本周访问数,IP以日(00:00-24:00,为一个IP)划分
	 * @param time
	 * @return
	 * @throws Exception
	 */
	public int queryUserByThisWeek(Date time) throws Exception;
	
	/**
	 * 根据今天日期查询本月访问数,IP以日(00:00-24:00,为一个IP)划分
	 * @param time
	 * @return
	 * @throws Exception
	 */
	public int queryUsrByThisMonth(Date time) throws Exception;
	
	/**
	 * 总的IP数,IP以日(00:00-24:00,为一个IP)划分
	 * @return
	 * @throws Exception
	 */
	public int queryUserTotal() throws Exception;
	
	/**
	 * 根据IP查询URL
	 * @param ip
	 * @return
	 * @throws Exception
	 */
	public String queryUserUrl(String ip) throws Exception;
	
	/**
	 * 根据IP查询时间
	 * @param ip
	 * @return
	 * @throws Exception
	 */
	public boolean queryIpTime(String ip) throws Exception;
	
	/**
	 * 根据某IP查询访问次数
	 * @param ip
	 * @return
	 * @throws Exception
	 */
	public int queryIpCountByIp(String ip) throws Exception;
	
	/**
	 * 总的VP数,即总的点击数
	 * @return
	 * @throws Exception
	 */
	public int queryTotalClick() throws Exception;
	
	/**
	 * 查找关键字排行榜
	 * @return
	 * @throws Exception
	 */
	public Map<String,Integer> queryTopkeywords() throws Exception;
	
	/**
	 * 搜索引擎排行榜
	 * @return
	 * @throws Exception
	 */
	public Map<String,Integer> querySearchEngine() throws Exception;
	
	/**
	 * 接入商排行榜
	 * @return
	 * @throws Exception
	 */
	public Map<String,Integer> queryConnectBusiness() throws Exception;
	
	/**
	 * 时间段排行榜
	 * @return
	 * @throws Exception
	 */
	public Map<String,Integer> queryVisitDate() throws Exception;
	
	/**
	 * 独立IP访问最高日期
	 * @return
	 * @throws Exception
	 */
	public Map<String,Integer> queryTopDistinctIpDate() throws Exception;
	
	/**
	 * 最高浏览量日期
	 * @return
	 * @throws Exception
	 */
	public Map<String,Integer> queryTopCountIpDate() throws Exception;
	
	/**
	 * 按选定日期查询独立IP访问量
	 * @return
	 * @throws Exception
	 */
	public Map<String,Integer> queryChooseDateCountIp(String startTime,String endTime) throws Exception;
	
	/**
	 * 页面浏览访问量排行榜
	 * @return
	 * @throws Exception
	 */
	public Map<String,Integer> queryPageTatalPv() throws Exception;
}
